Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor server and proxy and remove gnet/v2 #344

Merged
merged 35 commits into from
Oct 17, 2023
Merged

Conversation

mostafa
Copy link
Member

@mostafa mostafa commented Oct 7, 2023

Ticket(s)

Description

In this PR I removed the gnet/v2 library that was being used to serve incoming client connections and replaced it with the net from the Go stdlib. I made many improvements, done many fixes and found and fixed many race conditions in the code.

Small timing benchmark with psql

Running psql with timing enabled and querying a table with 158369 records across 17 columns transfers 67736218 bytes (~67.73 MB) of data from PostgreSQL to the psql. This amount of data takes 292.501 ms to be received by psql when connecting to PostgreSQL directly, which increases by ~41% to 412.965 ms with the new changes in the current branch when psql connects through GatewayD with no plugins. There is a ~91% reduction from 679.758 ms with the latest version on the main branch.

Related PRs

Development Checklist

  • I have added a descriptive title to this PR.
  • I have squashed related commits together.
  • I have rebased my branch on top of the latest main branch.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added docstring(s) and type annotations to my code.
  • I have made corresponding changes to the documentation (docs).
  • I have added tests for my changes.

Legal Checklist

@mostafa mostafa linked an issue Oct 7, 2023 that may be closed by this pull request
4 tasks
@mostafa mostafa force-pushed the refactor-server-and-proxy branch from 186a038 to 07d9fa1 Compare October 7, 2023 09:36
@mostafa mostafa force-pushed the refactor-server-and-proxy branch from 07d9fa1 to f89cfde Compare October 7, 2023 22:37
@mostafa mostafa force-pushed the refactor-server-and-proxy branch 15 times, most recently from 2286c31 to 2d2fb86 Compare October 13, 2023 10:19
…e start/stop

Close channel after send
Close listener gracefully and raise error if something happened
Use for/select for stopping long-running goroutines gracefully
…d plugin registry

Check if the client is actually connected before closing it
Stop scheduler before clearing the jobs (safer)
@mostafa mostafa force-pushed the refactor-server-and-proxy branch from e904023 to 8013cb9 Compare October 15, 2023 12:07
@mostafa mostafa force-pushed the refactor-server-and-proxy branch from 6d1e6db to 91998ea Compare October 15, 2023 15:07
@mostafa mostafa force-pushed the refactor-server-and-proxy branch from 7b7dc3a to f377c83 Compare October 15, 2023 15:58
@mostafa mostafa changed the title WIP: refactor server and proxy and remove gnet/v2 Refactor server and proxy and remove gnet/v2 Oct 17, 2023
@mostafa mostafa marked this pull request as ready for review October 17, 2023 21:22
@mostafa mostafa merged commit 2ef135f into main Oct 17, 2023
2 checks passed
@mostafa mostafa deleted the refactor-server-and-proxy branch October 17, 2023 21:27
@mostafa mostafa mentioned this pull request Oct 26, 2023
3 tasks
@mostafa mostafa mentioned this pull request Nov 7, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor server and proxy
1 participant